<template>
<div>
  <el-breadcrumb
    separator-class="el-icon-arrow-left"
    style="margin-right: 30px;position:absolute;right:0;ub main-center cross-center"
  >
    <el-breadcrumb-item :to="{ path: '/' }">业务管理</el-breadcrumb-item>
    <el-breadcrumb-item>配送中心</el-breadcrumb-item>
  </el-breadcrumb>

  <el-date-picker
      v-model="date"
      type="datetimerange"
      :picker-options="pickerOptions2"
      range-separator="至"
      start-placeholder="开始日期"
      end-placeholder="结束日期"
      align="right">
    </el-date-picker>
     <el-button class="btn" type="warning" icon="el-icon-star-off" circle  @click="getCommodityStatisticsVo">查询</el-button>
<el-table
    ref="filterTable"
    :data="form1"
    style="width: 100%">
    <el-table-column
      type="selection"
      width="55">
    </el-table-column>
    <el-table-column
      prop="commodityNumber"
      label="商品订购数量"
      width="100">
    </el-table-column>
    <el-table-column
      prop="comodityName"
      label="商品名称"
      width="100">
    </el-table-column>
    <el-table-column label="操作">
      <template>
      <el-button class="btn" type="primary" icon="el-icon-star-off" circle  @click="getCommodityStatisticsVo">查询</el-button>
      </template>
    </el-table-column>
  </el-table>

</div>
</template>

<script>
export default {
  data() {
    return{
      form1:[],
      date:[],
       pickerOptions2: {
          shortcuts: [{
            text: '最近一周',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近一个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近三个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit('pick', [start, end]);
            }
          }]
        }
    }
  },
  methods:{
    async getCommodityStatisticsVo () {
      const {data:res} = await this.$http.post('/api/send/getCommodityStatisticsVo',{
        // 'endTime':this.date[1],
        // 'startTime':this.date[0]
      })
      console.log(res)
      let form1 = res.data
      this.form1 = form1
    }
  },
  created () {
    this.getCommodityStatisticsVo()
  }
};
</script>

<style scoped>

</style>